﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Microsoft.Forums.ForumsClient.Models
{
    /// <summary>
    ///  Data Model to capture the user Filter settings.
    /// </summary>
    public class ThreadFilterSettings : BindableObject
    {
        /// <summary>
        ///  Has user selected Helpful filter
        /// </summary>
        private bool isCheckedHelpful;

        /// <summary>
        ///  Has user selected NoReplies filter
        /// </summary>
        private bool isCheckedNoReplies;

        private bool isCheckedAnswered;

        private bool isCheckedUnanswered;

        private bool isCheckedProposedAnswers;

        private bool isCheckedGeneralDiscussion;

        private string searchText;



        /// <summary>
        ///  Get / Set ResetFilterBy. This is typically bound to the "Show All" item of
        ///  FilterBy UI element on the forum Filter.
        /// </summary>
        public bool ResetFilterBy
        {
            get
            {
                return (IsCheckedAnswered ||
                       IsCheckedUnanswered ||
                       IsCheckedProposedAnswers ||
                       IsCheckedGeneralDiscussion) == false;
            }
            set
            {
                if (value == true)
                {
                    IsCheckedAnswered = IsCheckedUnanswered = IsCheckedProposedAnswers = IsCheckedGeneralDiscussion = false;
                    OnPropertyChanged("ResetFilterBy");
                }
            }
        }


        /// <summary>
        /// Gets or sets the search text.
        /// </summary>
        /// <value>The search text.</value>
        public string SearchText
        {
            get
            {
                return searchText;
            }
            set
            {
                searchText = value;
                OnPropertyChanged("SearchText");
            }
        }


        /// <summary>
        /// Gets or sets a value indicating whether this instance is checked proposed answers.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is checked proposed answers; otherwise, <c>false</c>.
        /// </value>
        public bool IsCheckedProposedAnswers
        {
            get
            {
                return isCheckedProposedAnswers;
            }
            set
            {
                isCheckedProposedAnswers = value;
                OnPropertyChanged("IsCheckedProposedAnswers");
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is checked answered.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is checked answered; otherwise, <c>false</c>.
        /// </value>
        public bool IsCheckedAnswered
        {
            get
            {
                return isCheckedAnswered;
            }
            set
            {
                isCheckedAnswered = value;
                OnPropertyChanged("IsCheckedAnswered");
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is checked unanswered.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is checked unanswered; otherwise, <c>false</c>.
        /// </value>
        public bool IsCheckedUnanswered
        {
            get
            {
                return isCheckedUnanswered;
            }
            set
            {
                isCheckedUnanswered = value;
                OnPropertyChanged("IsCheckedUnanswered");
            }
        }
        /// <summary>
        ///  Get / Set if user has selected Helpful filter
        /// </summary>
        public bool IsCheckedHelpful
        {
            get
            {
                return isCheckedHelpful;
            }
            set
            {
                isCheckedHelpful = value;
                OnPropertyChanged("IsCheckedHelpful");
            }
        }

        /// <summary>
        ///  Get / Set if user has selected NoReplies filter
        /// </summary>
        public bool IsCheckedNoReplies
        {
            get
            {
                return isCheckedNoReplies;
            }
            set
            {
                isCheckedNoReplies = value;
                OnPropertyChanged("IsCheckedNoReplies");
            }
        }

        /// <summary>
        ///  Get / Set if user has selected General Discussion filter
        /// </summary>
        public bool IsCheckedGeneralDiscussion
        {
            get
            {
                return isCheckedGeneralDiscussion;
            }
            set
            {
                isCheckedGeneralDiscussion = value;
                OnPropertyChanged("IsCheckedGeneralDiscussion");
            }
        }
    }
}
